var t,
  n,
  a = require("../../@babel/runtime/helpers/defineProperty"),
  i = require("../../res/www.a9a.cn.js"),
  e = getApp();
Page({
  data: { nTitle: "", setInter: "" },
  onLoad: function (t) {
    var a = this;
    (n = t.id),
      e.get_config("_ZEAI").then(function (t) {
        a.setData({ color: e._ZEAI.color, rgbcolor: i.c16_rgb(e._ZEAI.color) });
      }),
      e.get_navigationBarTopHeight(a);
  },
  onShow: function () {
    this.init();
  },
  init: function () {
    var a = this;
    i.ifint(n) ||
      wx.showModal({
        content: "id跑路了",
        confirmColor: a.data.color,
        confirmText: "朕知道了",
        showCancel: !1,
        success: function (t) {
          wx.navigateBack();
        },
      });
    a = this;
    wx.showLoading({ title: "拼命加载中...", mask: !0 });
    var o = {
      submitok: "huxuan_detail",
      openid: (t = wx.getStorageSync("COOK_U")).openid,
      id: n,
    };
    e.ajax({
      url: "huxuan.php",
      data: o,
      success: function (t) {
        1 == t.flag
          ? (a.setData({
              nTitle: t.D.title,
              tjarr: t.tjarr,
              SHARE: t.SHARE,
              D: t.D,
              BM: t.BM,
              MARQUEE: t.MARQUEE,
              DJS: t.DJS,
              KEFU: t.KEFU,
              BTN: t.BTN,
              ios_ifpay: t.ios_ifpay,
              content: i.escape2Html(t.D.content),
            }),
            1 == t.DJS.flag && a.DJSFn(t.DJS.difftime))
          : wx.showToast({ title: t.msg, icon: "none", mask: !0 }),
          wx.hideLoading();
      },
    });
  },
  BTNfn: function () {
    var a = this;
    e.chklogin().then(function (o) {
      if (o)
        switch (a.data.BTN.submitok) {
          case "enter":
            wx.navigateTo({ url: "huxuan_detail_ulist?id=" + n });
            break;
          case "bm":
            (t = wx.getStorageSync("COOK_U")),
              e.ajax({
                url: "huxuan.php",
                data: { submitok: "huxuan_detail_bm", id: n, openid: t.openid },
                success: function (t) {
                  1 == t.flag
                    ? (wx.showToast({ title: t.msg, mask: !0, duration: 3e3 }),
                      setTimeout(function () {
                        a.init();
                      }, 2e3))
                    : ((t.this = a), (t.url = "no"), i.sorry(t));
                },
              });
            break;
          case "pay":
            1 != a.data.ios_ifpay.flag
              ? wx.getSystemInfo({
                  success: function (t) {
                    "ios" == t.platform
                      ? wx.showModal({
                          title: "温馨提示",
                          content: a.data.ios_ifpay.tips,
                          confirmColor: a.data.color,
                          cancelText: "返回",
                          confirmText: "联系服务人员",
                          success: function (t) {
                            t.confirm
                              ? wx.redirectTo({ url: "../my/hongniang" })
                              : t.cancel && wx.navigateBack();
                          },
                        })
                      : e.pay({
                          data: { submitok: "huxuan_bm_pay", id: n },
                          success: function (t) {
                            wx.showToast({
                              title: t.msg,
                              mask: !0,
                              duration: 3e3,
                            }),
                              setTimeout(function () {
                                a.init();
                              }, 3e3);
                          },
                          fail: function (t) {
                            (t.this = a), (t.url = "no"), i.sorry(t);
                          },
                        });
                  },
                })
              : e.pay({
                  data: { submitok: "huxuan_bm_pay", id: n },
                  success: function (t) {
                    wx.showToast({ title: t.msg, mask: !0, duration: 3e3 }),
                      setTimeout(function () {
                        a.init();
                      }, 3e3);
                  },
                  fail: function (t) {
                    (t.this = a), (t.url = "no"), i.sorry(t);
                  },
                });
        }
      else wx.navigateTo({ url: "../login/login" });
    });
  },
  DJSFn: function (t) {
    var n = this;
    n.data.setInter = setInterval(function () {
      var a = 0,
        i = 0,
        e = 0;
      t > 0
        ? ((a = Math.floor(t / 3600)),
          (i = Math.floor(t / 60) - 60 * a),
          (e = Math.floor(t) - 60 * a * 60 - 60 * i),
          a <= 9 && (a = "0" + a),
          i <= 9 && (i = "0" + i),
          e <= 9 && (e = "0" + e),
          n.setData({ djs_H: a, djs_M: i, djs_S: e }),
          t--)
        : (clearInterval(n.data.setInter), n.init());
    }, 1e3);
  },
  telFn: function (t) {
    var n = this.data.KEFU.tel;
    wx.makePhoneCall({ phoneNumber: n });
  },
  kefuFn: function (t) {
    this.setData({ kefushow: !0 });
  },
  kefu_closeFn: function () {
    this.setData({ kefushow: !1 });
  },
  back: function () {
    this.setData({ div_login: !1 });
  },
  mask_closeFn: function (t) {
    var n = this,
      i = t.currentTarget.dataset.maskid;
    this.setData({ mask_class: "alpha100_0" }),
      setTimeout(function () {
        n.setData(a({}, i, !1));
      }, 500);
  },
  vipFn: function () {
    e.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../my_vip/my_vip" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  certFn: function () {
    e.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../my/cert" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  dataFn: function () {
    e.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../reg/reg" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  getPhoneNumber: function (t) {
    e.getPhoneNumber({ e: t, url: "../my/my" });
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/huxuan/huxuan_detail?id=" + n,
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "id=" + n,
      path: "/pages/huxuan/huxuan_detail",
    };
  },
  ifagreeFn: function (t) {
    1 == t.detail.value
      ? this.setData({ ifagree: !0 })
      : this.setData({ ifagree: !1 });
  },
  ifagree_passFn: function () {
    wx.showToast({
      title: "请先点击同意《用户协议》和《隐私条款》",
      icon: "none",
      mask: !0,
      duration: 3e3,
    });
  },
});
